import CommonNode from '@/Model/Node/CommonNode'
import React, { useState, useContext } from 'react'

import TextField from '@mui/material/TextField'
import NodeCard from './NodeCard'
import useEditor from '../hooks/useEditor'

interface Props{
  data: CommonNode
}

export default function CommonCard (props: Props) {
  const {handleOnChangeTitle, handleOnChangeDesc, handleOnChangeAction } = useEditor(props.data.uuid)
  
  return <NodeCard data={props.data} type="普通">
    <TextField variant="standard" multiline onChange={handleOnChangeTitle}  label="标题:" value={props.data.title} style={{width: '100%'}} />
    <TextField
      onChange={handleOnChangeDesc}
      multiline
      label="描述:"
      value={props.data.desc}
      variant="standard"
      style={{width: '100%'}}  />
    <TextField 
      onInput={handleOnChangeAction}
      variant="standard" size="small" multiline fullWidth value={props.data.action} label="动作:" />
  </NodeCard>
}
